﻿@model CMIS_web_bootstrap.Startup

@{
    ViewBag.Title = "Lista de documentos";
}

   
  
<div class="container-fluid">
    <div class="row">
    <div class="col-lg-4">
        <h2>Lista de documentos</h2>
    </div>
        <div class="col-lg-2">
            <button type="button" class="btn btn-default btn-lg" data-toggle="modal" data-target="#myUploaderModal">
                <span class="glyphicon glyphicon-upload"></span> Subir Documentación
            </button>
        </div>
        <div class="col-xs-6">
            <form class="navbar-form navbar-right " role="search">
            <div class="form-group">
                <input class="form-control" type="text" placeholder="Escriba aqui...">
            </div>
            <button class="btn btn-default" type="submit">Buscar!</button>
            </form>
        </div><!-- /.col-lg-6 -->
    </div><!-- /.row -->
</div>
    <table class="table">
        <thead>
            <tr>
                <th>Número de Empleado</th>
                <th>Nombre</th>
                <th>Apelidos</th>
                <th>DNI</th>
                <th>Acciones</th>
            </tr>
        </thead>
        <tbody>
            @{int i = 0;
            foreach (CMIS_WEB.Models.Documento doc in (List<CMIS_WEB.Models.Documento>)ViewData["folder list"])
            {
                
                <tr>
                    <td>@doc.numEmpleado</td>
                    <td>@doc.nombre_presona</td>
                    <td>@doc.apellidos</td>
                    <td>@doc.dni</td>
                    <td>
                        <div class="bs-glyphicons">
                            <button type="button" id="descargar" onclick="location.href='@doc.documento'" class="btn btn-link" >
                                <span class="glyphicon glyphicon-floppy-save"></span>
                                <span class="glyphicon-class">Descargar</span>
                            </button>
                            <button type="button" id="visualizar" class="btn btn-link" data-toggle="modal" data-target="#myModal@(i.ToString())">
                                <span class="glyphicon glyphicon-eye-open"></span>
                                <span class="glyphicon-class">Visualizar</span>
                            </button>
                            <button type="button" id="eliminar" class="btn btn-link" data-toggle="modal" data-target="#myEliminateModal@(i.ToString())">
                                <span class="glyphicon glyphicon-remove"></span>
                                <span class="glyphicon-class">Eliminar</span>
                        </button>
                            <!-- Modal -->
                            <div class="modal fade" id="myModal@(i.ToString())" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                                <div class="modal-dialog modal-lg">
                                    <div class="modal-content">
                                        <div class="modal-header">
                                            <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                                            <h4 class="modal-title" id="myModalLabel">@doc.numEmpleado</h4>
                                        </div>
                                        <div class="modal-body container-fluid">
                                            <embed src="@doc.url_visualizar" width="850" height="500" alt="pdf" pluginspage="http://www.adobe.com/products/acrobat/readstep2.html">
                                        </div>
                                        <div class="modal-footer">
                                            <button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
                                            <button type="button" class="btn btn-primary">Descargar</button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <!--Mensaje de Eliminación de documentos -->
                            <div class="modal fade" id="myEliminateModal@(i.ToString())" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                                <div class="modal-dialog">
                                    <div class="modal-content">
                                        <div class="modal-header">
                                            <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                                            <h4 class="modal-title" id="myModalLabel">¿Está seguro/a que desea eliminar el documento?</h4>
                                        </div>
                                        <div class="modal-footer">
                                            @using (Html.BeginForm("EliminarDocumento", "content"))
                                            {
                                                <input type="hidden" name="id_Doc" id="id_Doc" value="@doc.iddocumento" />
                                                <button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
                                                <input type="submit" class="btn btn-primary" value="Aceptar"/>
                                            }
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </td>
                </tr>
                i = i+1;
            }}

            <!-- Modal -->
            <div class="modal fade" id="myUploaderModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                            <h4 class="modal-title" id="myModalLabel">Subir documentación</h4>
                        </div>

                        
                           @Html.Partial("CreateDocument")


                    </div>
                </div>
            </div>

        </tbody>
    </table>
